package com.example.demo.pattern.iteratorpattern;

public class Start {
    public static void main(String[] args) {
        //主要实现是组合模式了，Menu和MenuItem同作为MenuComponent。迭代器模式也可以牵强的用Menu的List迭代器和MenuItem的空迭代器来说
        MenuComponent menu = new Menu("菜单");

        menu.addMenu(new MenuItem("冰阔落"));
        menu.addMenu(new MenuItem("卡布奇诺"));

        Menu meatMenu = new Menu("肉类菜单");
        meatMenu.addMenu(new MenuItem("只因肉"));
        meatMenu.addMenu(new MenuItem("曼巴肉"));
        menu.addMenu(meatMenu);

        Menu vegetableMenu = new Menu("蔬菜菜单");
        vegetableMenu.addMenu(new MenuItem("红菜菜"));
        vegetableMenu.addMenu(new MenuItem("绿叶叶"));
        menu.addMenu(vegetableMenu);

        Waitness waitness = new Waitness(menu);
        waitness.print();
    }
}